package Encapsulation.封装;

import sun.awt.windows.WPrinterJob;

public class recursion {

    public static int getSum(int n){
        if (n == 1) {
            return 1;
        }
        int temp = getSum(n-1);
        System.out.println(temp);
        return temp+n;
    }

    public static void main(String[] args) {
        int sum =getSum(4);
        System.out.println("sum:"+sum);
    }
}
